package com.oocl.ita.linstner.chatframe;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;

import com.oocl.ita.qqclientt.QQClient;
import com.oocl.ita.sakura.protocol.Protocol;

public class LogoutListener implements ActionListener{

	@Override
	public void actionPerformed(ActionEvent e) {
		/*
		 * 1. 封装logout Protocol 
		 * 		from 
		 * 
		 * 2. 发送
		 */
		System.out.println("LogoutListener : "  + QQClient.getClient());
		
		// 封装报文 
		Protocol protocol = new Protocol("logout");
		protocol.encapsulate("from", QQClient.getClient());
		System.out.println("LogoutListener : "  + QQClient.getClient() + " " + protocol);
		
		// 发送
		try {
			QQClient.getOos().writeObject(protocol);
		} catch (IOException e1) {
			// TODO Auto-generated catch block
			e1.printStackTrace();
		}
	}

}
